include ../common.mk

CFLAGS = $(CFLAGS_STD) $(CFLAGS_UORC) $(CFLAGS_COMMON) $(CFLAGS_GLIB) $(CFLAGS_LCM) $(CFLAGS_LCMTYPES) -D_GNU_SOURCE
LDFLAGS = $(LDFLAGS_STD) $(LDFLAGS_UORC) $(LDFLAGS_COMMON) $(LDFLAGS_GLIB) $(LDFLAGS_LCM) $(LDFLAGS_LCMTYPES)

LDFLAGS += -lpthread -lm

BINARY:=$(BIN_PATH)/motordriver
OBJS:=main.o

.PHONY: all test clean tidy

all: $(BINARY) $(OBJS)

$(BINARY): $(OBJS)
	@echo "    [$@]"
	$(CC) -o $@ $(OBJS) $(LDFLAGS)

%.o: %.c
	@echo "    [$@]"
	$(CC) -c -o $@ $< $(CFLAGS)

clean: tidy
	rm -f $(motordriver)

tidy:
	rm -f *.o *~
